Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

NS_DEV_DOCFOR:objc_class:Slider;,Slider

Inherits From:	Control : View : Responder : Object

Declared In:	appkit/Slider.h

Class Description

Slider is a type of Control with a sliding knob that can be moved to represent a value between a minimum and a maximum.  A Slider may be either horizontal or vertical, but its minimum value is always at the left or bottom end of the bar, and the maximum at the right or top.  By default, a Slider is a continuous Control:  it sends it action message to its target continuously while the user drags its knob.  To configure a Slider to send its action only when the mouse is released, send setContinuous: with an argument of NO.

A Slider can be configured to display an image, a title, or both, in its bar behind its knob.  A Slider's title can be drawn in any gray level or color, and in any font available.  A Slider's value can be set programmatically with any of the standard Control value-setting methods, such as setFloatValue:.  For more information on the behavior of these methods in Slider, see the SliderCell class specification.

Instance Variables

None declared in this class.

Method Types

Setting Slider's Cell Class	+ setCellClass:

Initializing a new Slider	- initFrame:

Modifying a Slider's appearance
- setKnobThickness:
- knobThickness
- setImage:
- image
- setTitle:
- setTitleNoCopy:
- title
- setTitleCell:
- titleCell
- setTitleFont:
- titleFont
- setTitleColor:
- titleColor
- setTitleGray:
- titleGray
- isVertical

Setting value limits	- setMinValue:
- minValue
- setMaxValue: 
- maxValue

Resizing the Slider	- sizeToFit

Handling events	- acceptsFirstMouse
- setEnabled:
- mouseDown:

Class Methods

NS_DEV_DOCFOR:objc_method:[Slider-setCellClass:];,setCellClass:

+ setCellClass:classId

Configures the Slider class to use instances of classId for its Cells.  classId should be the id of a subclass of SliderCell, obtained by sending the class message to either the SliderCell subclass object or to an instance of that subclass.  The default Cell class is SliderCell.  Returns self.

If this method isn't overridden by a subclass of Slider, then when it's sent to that subclass,  Slider and any other subclasses of Slider that don't override the methods mentioned below will use the new Cell subclass as well.  To safely set a Cell class for your subclass of Slider, override this method to store the Cell class in a static id.  Also, override the designated initializer to replace the Slider subclass instance's Cell with an instance of the Cell subclass stored in that static id.  See ªCreating New Controlsº in the Control class specification for more information.

Instance Methods

NS_DEV_DOCFOR:objc_method:[Slider-acceptsFirstMouse];,acceptsFirstMouse

- (BOOL)acceptsFirstMouse

Returns YES since Sliders always accept a mouse-down event that activates a Window, whether or not the Slider is enabled.

NS_DEV_DOCFOR:objc_method:[Slider-image];,image

- image

Returns the NXImage that the Slider displays in its bar, or nil if one hasn't been set.

See also:  - setImage:

NS_DEV_DOCFOR:objc_method:[Slider-initFrame:];,initFrame:

- initFrame:(const NXRect *)frameRect

Initializes and returns the receiver, a new instance of Slider.  The Slider will be horizontal if frameRect is wider than it is high; otherwise it will be vertical.  By default, the Slider is continuous.  After initializing the Slider, invoke the sizeToFit method to resize the Slider to accommodate its knob.  This method is the designated initializer for the Slider class.

See also:  - sizeToFit, - isVertical, - isContinuous (Control), - setContinuous: (Control)

NS_DEV_DOCFOR:objc_method:[Slider-isVertical];,isVertical

- (int)isVertical

Returns 1 if the Slider is vertical, 0 if it's horizontal, and -1 if the orientation can't be determined (because the Slider hasn't been initialized, for example).  A Slider is vertical if its height is greater than its width.

NS_DEV_DOCFOR:objc_method:[Slider-knobThickness];,knobThickness

- (NXCoord)knobThickness

Returns the thickness of the Slider's knob (that is, its extent along the bar's length) in the Slider's coordinate system.

See also:  - setKnobThickness:

NS_DEV_DOCFOR:objc_method:[Slider-maxValue];,maxValue

- (double)maxValue

Returns the maximum value of the Slider.

See also:  - setMaxValue:, - minValue

NS_DEV_DOCFOR:objc_method:[Slider-minValue];,minValue

- (double)minValue

Returns the minimum value of the Slider.

See also:  - setMinValue:, - maxValue

NS_DEV_DOCFOR:objc_method:[Slider-mouseDown:];,mouseDown:

- mouseDown:(NXEvent *)theEvent

Tracks the mouse until a mouse-up event occurs, updating the knob's position to follow the cursor as it's dragged.  Returns self.

See also:  - trackMouse:inRect:ofView: (SliderCell)

NS_DEV_DOCFOR:objc_method:[Slider-setEnabled:];,setEnabled:

- setEnabled:(BOOL)flag

If flag is YES, enables the Slider; if NO, disables the Slider.  Redraws the interior of the Slider if autodisplay is on and the enabled state changes.  Returns self.

See also:  - isEnabled (Control), - setAutodisplay: (View)

NS_DEV_DOCFOR:objc_method:[Slider-setImage:];,setImage:

- setImage:image

Sets the NXImage used as the Slider's bar.  This method doesn't scale the NXImage.  Returns self.

NS_DEV_DOCFOR:objc_method:[Slider-setKnobThickness:];,setKnobThickness:

- setKnobThickness:(NXCoord)aFloat

Sets the thickness of the Slider's knob (that is, its extent along the bar's length) in its own coordinate system.  aFloat must be greater than 0.0, and shouldn't be greater than the Slider's length.  If the knob thickness changes, the Slider's inside is redrawn.  Returns self.

See also:  - knobThickness

NS_DEV_DOCFOR:objc_method:[Slider-setMaxValue:];,setMaxValue:

- setMaxValue:(double)aDouble

Sets the maximum value of the Slider to aDouble and returns self.  If the maximum value changes, the Slider's inside is redrawn to reposition the knob relative to the new maximum.

See also:  - maxValue, - setMinValue:

NS_DEV_DOCFOR:objc_method:[Slider-setMinValue:];,setMinValue:

- setMinValue:(double)aDouble

Sets the minimum value of the Slider to aDouble and returns self.  If the minimum value changes, the Slider's inside is redrawn to reposition the knob relative to the new minimum.

See also:  - minValue, - setMaxValue:

NS_DEV_DOCFOR:objc_method:[Slider-setTitle:];,setTitle:

- setTitle:(const char *)aString

Sets the title drawn over the Slider's bar to aString.  Returns self.

See also:  - setTitleNoCopy:, - title

NS_DEV_DOCFOR:objc_method:[Slider-setTitleCell:];,setTitleCell:

- setTitleCell:aCell

Sets the Cell used to draw the Slider's title.  aCell should be an instance of TextFieldCell (or of a subclass).  Doesn't redraw the Slider; furthermore, a setTitle: message is required to display a title, even if aCell already has a string value.  Returns the old Cell.

See also:  - titleCell, - setTitle:

NS_DEV_DOCFOR:objc_method:[Slider-setTitleColor:];,setTitleColor:

- setTitleColor:(NXColor)color

Sets the color used to draw the Slider's title, redraws the Slider's inside, and returns self.  The default is to draw in a gray level of 0.0 (NX_BLACK).

See also:  - titleColor, - setTitleGray:, - titleGray

NS_DEV_DOCFOR:objc_method:[Slider-setTitleFont:];,setTitleFont:

- setTitleFont:fontObject

Sets the Font used to draw the SliderCell's title and redraws the Slider's inside.  The default font is the default system font as set by the user (with the Preferences application), and its size is 12.0 point.  Returns self.

See also:  - titleFont

NS_DEV_DOCFOR:objc_method:[Slider-setTitleGray:];,setTitleGray:

- setTitleGray:(float)aFloat

Sets the gray value used to draw the Slider's title, redraws the Slider's inside, and returns self.  The default gray level is 0.0 (NX_BLACK).

See also:  - titleGray, - setTitleColor:, - titleColor

NS_DEV_DOCFOR:objc_method:[Slider-setTitleNoCopy:];,setTitleNoCopy:

- setTitleNoCopy:(const char *)aString

Sets the title drawn over the Slider's bar to aString, but doesn't copy the string.  Returns self.

See also:  - setTitle:, - title

NS_DEV_DOCFOR:objc_method:[Slider-sizeToFit];,sizeToFit

- sizeToFit

The Slider is sized to fit its cell, and its width is adjusted so that its knob fits exactly in its border.  Returns self.

NS_DEV_DOCFOR:objc_method:[Slider-title];,title

- (const char *)title

Returns the string used as the Slider's title.  The title is drawn over the Slider's bar.  Returns self.

See also:  - setTitle:

NS_DEV_DOCFOR:objc_method:[Slider-titleCell];,titleCell

- titleCell

Returns the TextFieldCell used to draw the Slider's title.  If the Slider doesn't have a title, a new TextFieldCell is created and returned.  This doesn't result in a title getting set.

See also:  - setTitleCell:

NS_DEV_DOCFOR:objc_method:[Slider-titleColor];,titleColor

- (NXColor)titleColor

Returns the color used to draw the Slider's title.  The default is to draw in a gray level of 0.0 (NX_BLACK).  Returns self.

See also:  - setTitleColor:, - titleGray, - setTitleGray:

NS_DEV_DOCFOR:objc_method:[Slider-titleFont];,titleFont

- titleFont

Returns the Font used to draw the Slider's title.  The default font is the default system font as set by the user (with the Preferences application), and its size is 12.0 point.

See also:  - setTitleFont:

NS_DEV_DOCFOR:objc_method:[Slider-titleGray];,titleGray

- (float)titleGray

Returns the gray value used to draw the Slider's title.  The default gray level is 0.0 (NX_BLACK).  Returns self.

See also:  - setTitleGray:, - titleColor, - setTitleColor: